<%@ page import="org.jackysoft.entity.User"%>
<%@ page contentType="text/html; charset=utf-8" 
import="org.jackysoft.util.SpringSecurityUtils"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>	
<script src="${sbase}scripts/jquery-1.7.1.js" type="text/javascript"></script>
<script type="text/javascript" src="${sbase}scripts/tools.js"></script>
<title>文档浏览器</title>
<style type="text/css">
*{
font-size:12px;
margin:0;
}
</style>

	</head>
	<body>
<%

           
            String base = (String)session.getAttribute("base");
            String extision = request.getParameter("extision");
            String openUrl = base+request.getParameter("openurl");          
             
           
			//-------- SOAOFFICE 服务器端编程开始 ------------------------ //
			SOAOfficeX.SOAOfficeCtrl SOACtrl = new SOAOfficeX.SOAOfficeCtrl(pageContext);
          
			// 设置SOAOFFICE中间件服务页面			
			SOACtrl.ServerURL = base+"soalet/soaserv.do";

			// 设置界面样式
			SOACtrl.MainStyle = 2;
			SOACtrl.Caption = "您可以修改这里的文字，正式版本的控件不会出现科翰软件的关于对话框";
			SOACtrl.BorderStyle = 0;
			SOACtrl.Titlebar = false;
			SOACtrl.AllowPrintCopies=0;
			SOACtrl.Toolbars=false;
			
			SOACtrl.Menubar = false;
			SOACtrl.Toolbars = false;
			           
			
			//设置保存文档的服务器页面
			User user = SpringSecurityUtils.getCurrentUser();
			
			String pid = "Word.Document";
			if("doc".equalsIgnoreCase(extision))
				pid = "Word.Document";
			else if("xls".equalsIgnoreCase(extision))
				pid = "Excel.Sheet";
			else if("ppt".equalsIgnoreCase(extision) || "pps".equalsIgnoreCase(extision))
				pid = "PowerPoint.Show";
			else
				pid="unkown";
		   
            //out.println(saveUrl);           
            // 打开文档			          
			SOACtrl.webOpen(openUrl, 0, user.getLocalName(), pid);
			// -------- SOAOFFICE 服务器端编程结束 ------------------------ //
%>
		
<form name="formData" method="post"  id="formData">
<!--**************   SOAOFFICE 客户端代码开始    ************************-->
	<SCRIPT language="JavaScript" event="OnInit()" for="SOAOfficeCtrl">
		// 控件打开文档前触发，用来初始化界面样式
		//var soa = document.getElementById("SOAOfficeCtrl");
		//SOAOfficeCtrl.ShowRevisions= false;//${param.showRevisions}||true;
	</SCRIPT>
	<SCRIPT language="JavaScript" event="OnDocumentOpened(str, obj)" for="SOAOfficeCtrl">
		// 控件打开文档后立即触发，
		//添加自定义菜单，自定义工具栏，禁止打印，
		//禁止另存，禁止保存等等
		//bDocOpen = true;
		//SOAOfficeCtrl.Document.Application.ActiveWindow.DisplayScreenTips = true;
	    SOAOfficeCtrl.ShowRevisions= false;
		//alert(SOAOfficeCtrl.ShowRevisions);
		//禁止保存
		SOAOfficeCtrl.EnableFileCommand(3) = false;
		//禁止另存
		SOAOfficeCtrl.EnableFileCommand(4) = false;
		//禁止打开
		SOAOfficeCtrl.EnableFileCommand(0) = false;

	</SCRIPT>
	<SCRIPT language="JavaScript" event="OnDocumentClosed()" for="SOAOfficeCtrl">
		//bDocOpen = false;
	</SCRIPT>
	<SCRIPT language="JavaScript" event="OnUserMenuClick(index, caption)" for="SOAOfficeCtrl">
		// 添加您的自定义菜单项事件响应
	</SCRIPT>
	<SCRIPT language="JavaScript" event="OnCustomToolBarClick(index, caption)" for="SOAOfficeCtrl">
		// 添加您的自定义工具栏按钮事件响应
	</SCRIPT>	
	<SCRIPT language="JavaScript" event="AfterDocumentSaved(SavedOK);" for="SOAOfficeCtrl">
		if(SavedOK){
            
	    }		
    </SCRIPT>
	
	<!--   OBJECT标签，客户端控件引用    -->
	<OBJECT id="SOAOfficeCtrl" codeBase="${base}jsp/common/SOAOffice.ocx#version=8,1,0,0" height="700" width="100%" classid="clsid:83171BA4-BDCA-42a8-BE44-745ABF36EB7E" data="" VIEWASTEXT>
		<div align=center STYLE="color:red;">本机尚未安装SOAOFFICE客户端控件，请安装浏览器上方黄色提示条或弹出提示框中的SOAOFFICE客户端控件。</div>
	</OBJECT>
	
<!--**************   SOAOFFICE 客户端代码结束    ************************-->
</form>
</body>
</html>
